﻿using System;
using System.Collections.Generic;

namespace Moonlite.ExtensionApi.GlobalInterfaces
{
    public class ProjectCollection : List<IProject>
    {
        public ProjectCollection RemoveDuplicates()
        {
            Dictionary<string, int> uniqueStore = new Dictionary<string, int>();
            ProjectCollection finalList = new ProjectCollection();
            foreach (IProject currentValue in this)
            {
                if (uniqueStore.ContainsKey(currentValue.Path) == false)
                {
                    uniqueStore.Add(currentValue.Path, 0);
                    finalList.Add(currentValue);
                }
            }

            return finalList;
        }


        public ProjectCollection()
        {

        }

        public ProjectCollection(int capacity)
            : base(capacity)
        {

        }

        public ProjectCollection(IEnumerable<IProject> collection)
            : base(collection)
        {

        }
    }
}
